﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using DAL;

namespace _3tiers
{
    public partial class Form_ThemBoMon : Form
    {
        public Form_ThemBoMon()
        {
            InitializeComponent();
        }
        DataAccess ac = new DataAccess();
        BLL.BLL business = new BLL.BLL();
        private void Form_ThemBoMon_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'quanLyLichDayDataSet10.tblBoMon' table. You can move, or remove it, as needed.
            this.tblBoMonTableAdapter.Fill(this.quanLyLichDayDataSet10.tblBoMon);
            // TODO: This line of code loads data into the 'quanLyLichDayDataSet9.tblKhoa' table. You can move, or remove it, as needed.
            this.tblKhoaTableAdapter.Fill(this.quanLyLichDayDataSet9.tblKhoa); 
            //string sql = "select IDBoMon,";
        }

        private void btThem_Click(object sender, EventArgs e)
        {
            try
            {
                string idkhoa = cbKhoa.SelectedValue.ToString();
                string sql = "insert into tblBoMon values('b','" + idkhoa + "','" + tbTenBoMon.Text + "')";
                business.Insert(sql);
                label2.Text = "Thêm bộ môn thành công.";
            }
            catch { label2.Text = "Thêm bộ môn thất bại"; }
            Form_ThemBoMon_Load(sender, e);
        }

        private void btreset_Click(object sender, EventArgs e)
        {
            tbTenBoMon.Text = "";
        }
    }
}
